package com.shop.shop.model;

import com.alibaba.fastjson.JSONArray;
import lombok.Data;

import java.math.BigDecimal;
import java.util.List;

@Data
public class Order {
    private String oid;
    private Long uid;
    private List<GoodCount> goodList;
    private String payWay;
    private BigDecimal sumPrice;
    private String generateDate;

    public Order() {
    }

    public Order(String oid, Long uid, List<GoodCount> goodList, String payWay, BigDecimal sumPrice, String generateDate) {
        this.oid = oid;
        this.uid = uid;
        this.goodList = goodList;
        this.payWay = payWay;
        this.sumPrice = sumPrice;
        this.generateDate = generateDate;
    }

    public Order(OrderMysql orderMysql){
        this.oid=orderMysql.getOid();
        this.uid = orderMysql.getUid();
        this.payWay=orderMysql.getPayWay();
        this.sumPrice=orderMysql.getSumPrice();
        this.goodList= JSONArray.parseArray(orderMysql.getGoodList(),GoodCount.class);
    }
}
